package com.example.user.controller;

import com.example.common.model.UserDTO;
import com.example.user.model.User;
import com.example.user.service.UserService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@Tag(name = "用户模块", description = "用户相关接口")
public class UserController {

    @Autowired
    private UserService userService;

    @GetMapping("/info")
    public UserDTO getUserById(@RequestParam String id){
        return userService.getUserById(id);
    }


    @GetMapping("/getUserById")
    @Operation(summary = "根据用户ID获取用户信息",
            description = "通过用户ID查询数据库，返回用户实体")
    public User getUserById(@RequestParam Long id){
        return userService.getUserById(id);
    }



}
